using System;
using Calibur;

namespace EggWorld.Protocol {
	public class ObjectFactory : MessageBeanFactory {
		public override bool NeedZip(int cmdId) {
			switch (cmdId) {
				case -2000:
					return true;
			
				default:
					return false;
			}
		}
		
		public override Type GetMessageBeanType(int cmdId) {
			switch (cmdId) {
				// 玩家登录游戏服务器
				case  1000:	return typeof(Login);
				case -1000:	return typeof(LoginResponse);

				// 玩家行走（无响应）
				case  1001:	return typeof(Walk);

				// 玩家logout
				case  1002:	return typeof(NullMessageBean);
				case -1002:	return typeof(LogoutResponse);

				// 服务器Push系统广播
				case -1003:	return typeof(Push1003);

				// 测试指令
				case  2000:	return typeof(AllType);
				case -2000:	return typeof(AllType);

				default:
            		throw new ArgumentException("Undefined command ID and message bean class map:" + cmdId);
			}
		}
	}
}

